package com.eclipse.e0112_io.bz案例;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.Reader;

/*
 * 分别使用FileInputStream FileReader读取文件内容
 */
public class f晨考 {
	public static void main(String[] args) throws Exception {

		FileInputStream fis = new FileInputStream("/Users/liuzhuangzhuang/Desktop/io/a.txt");
		int num = 0;
		byte[] content = new byte[50];
		if(num != -1) {
			num = fis.read(content);
			System.out.println(new String(content, "utf-8"));
		}
		fis.close();
		
		File file = new File("/Users/liuzhuangzhuang/Desktop/io/a.txt");
		Reader reader = new FileReader(file);
		char[] arr = new char[50];
		int num1 = 0;
		while((num1 = reader.read(arr)) != -1) {
			String result = new String(arr, 0, num1);
			System.out.println(result); 
		}
		reader.close();
	}
}
